//2009/08/18 23:17:11
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class CuttingPoles
{
public:
    int countCuts(vector <int> poles)
    {
		int sum = 0;
		for(int i=0; i<poles.size(); i++) sum += poles[i];
		int aver = sum / poles.size();
		int id = 0;
		while(1)
		{
			sort(poles.begin(), poles.end());
			if(poles[poles.size() - 1] == aver) return id;
			int x = poles[poles.size() - 1] - aver;
			poles[0] += x;
			poles[poles.size() - 1] -= x;
			id++;
		}
    }
};
